import Vue from 'vue'
import VueRouter from 'vue-router'
import about from "../views/About.vue"
import deta from '../views/deta.vue'
import detlete from '../views/detlete.vue'
import all from '../views/all.vue'
import chat from '../views/chat.vue'
import search from '../views/search.vue'
import result from '../views/result.vue'
import streaming from '../views/streaming.vue'
import entire from '../views/entire.vue'
import anchor from '../views/anchor.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: {
      path: '/deta',
      query: {
        id: 'yz'
      }
    },
    // redirect:'/deta',
    name: 'about',
    
    component: about,
    children: [
      {
        path: '/deta',
        name: 'deta',
        component: deta,
      }, {
        path: '/all',
        name: 'all',
        component: all
      }
    ],
  },
  {
    path: '/detlete',
    name: 'detlete',
    component: detlete,
    children: [
      {
        path: '/chat',
        name: 'chat',
        component: chat
      }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: search,
  },
  {
    path: '/result',
    name: 'result',
    component: result,
    children: [
      {
        path: 'streaming',
        name: 'streaming',
        component: streaming
      },
      {
        path: 'entire',
        name: 'entire',
        component: entire
      },
      {
        path: 'anchor',
        name: 'anchor',
        component: anchor
      }
    ]
  }
]

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
const router = new VueRouter({
  mode: 'hash',
  routes
})

export default router
